package com.ifgostudio.bocai.system.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.ifgostudio.framework.entry.BaseEntity;

/**
 * 用户角色表
 * @author Wangjk
 * @Version 1.0
 * @Date 2013-4-1
 */
@Entity
@Table(name = "user_role")
public class UserRole extends BaseEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 4405127372354094056L;
	
	/**
	 * 用户
	 */
	@ManyToOne(cascade={CascadeType.ALL},optional=true)
	@JoinColumn(name = "user_id")
	private User user;
	
	/**
	 * 角色
	 */
	@ManyToOne(cascade={CascadeType.ALL},optional=true)
	@JoinColumn(name = "role_id")
	private Role role;

	/**
	 * 获取用户
	 * @return user 用户
	 */
	public User getUser() {
		return user;
	}

	/**
	 * 设置用户
	 * @param user 用户
	 */
	public void setUser(User user) {
		this.user = user;
	}

	/**
	 * 获取角色
	 * @return role 角色
	 */
	public Role getRole() {
		return role;
	}

	/**
	 * 设置角色
	 * @param role 角色
	 */
	public void setRole(Role role) {
		this.role = role;
	}

}
